package com.airticketbooking.mapper;

import com.airticketbooking.po.FlightSchedule;
import com.airticketbooking.query.FlightSchedulePageQuery;
import com.airticketbooking.vo.FlightScheduleVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper
public interface ScheduleMapper {

	Page<FlightScheduleVO> list(FlightSchedulePageQuery flightSchedulePageQuery);


	@Select("SELECT * FROM airticketbooking.schedule WHERE schedule_id = #{shcleID}")
	FlightSchedule getById(Integer scheduleID);

	Page<FlightScheduleVO> listAll();

	@Update("UPDATE airticketbooking.schedule SET status = #{status} WHERE schedule_id = #{id}")
	void modifyStatus(Integer id, Integer status);


	@Select("SELECT * FROM airticketbooking.schedule")
	List<FlightSchedule> getAll();


	Integer countFlightsInRangeTime(org.joda.time.DateTime startTime, org.joda.time.DateTime endTime);
}
